package expriment4_T9;

class Market {
    private String name;
    private Goods[] goodsList;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Goods[] getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(Goods[] goodsList) {
        this.goodsList = goodsList;
    }

    public Goods sell(String name) {
        for (Goods goods : goodsList) {
            if (goods.getName().equals(name)) {
                return goods;
            }
        }
        return null;
    }
}
